package vip.web3.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * <ul>
 * <li>文件包名 : com.coldlar.common.util</li>
 * <li>创建时间 : 2018/7/18 9:44</li>
 * <li>修改记录 : 无</li>
 * </ul>
 * 类说明：生成订单号
 * @version 1.0.0
 */
public class OrderUtil {

    static int len = 10;
    public static Random ran = new Random();

    public static synchronized String getOrderNo() {
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyMMdd");
        SimpleDateFormat sdf2 = new SimpleDateFormat("HHmmss");
        StringBuffer sb = new StringBuffer();
        sb.append(sdf1.format(new Date()));
        StringBuffer ranNum = new StringBuffer();
        for (int i = 0; i < len; i++) {
            int k = ran.nextInt(10);
            ranNum.append(k);

        }
        sb.append(ranNum);
//        sb.append(sdf2.format(new Date()));
        return sb.toString();
    }
    public static void main(String[] args) {
        for(int i =0;i<20;i++){

            System.out.println(getOrderNo());
        }
    }
}
